package com.xiaoxin.experience.system.runner;

import com.xiaoxin.experience.util.SystemUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @author xiaoxin
 */
@Component
public class ToWebBrowserRunner implements ApplicationRunner
{
    @Value("${http.server.port}")
    private int port;

    @Override
    public void run(ApplicationArguments args) throws Exception
    {
        if (SystemUtil.isLinux())
        {
            return;
        }
        Runtime.getRuntime().exec("cmd /c start http://localhost:" + port);
    }
}
